x = 1
y = 1
z = 120 - x - y
res = 3
res_max = 3
for p in range(3, 1001):
    s = set()
    for x in range(1, (p + 1) // 2):
        for y in range(x, (p + 1) // 2):
            if p ** 2 - 2 * p * (x + y) + 2 * x * y == 0:
                s.add(str(sorted([x, y, z])))
    if len(s) > res_max:
        res_max = len(s)
        res = p
print(res)
